﻿/*
OpenShell: An open source library that implements the Powershell engine for console applications
Copyright (C) 2011 Bryan Perris

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation.Host;
using System.Text;

namespace OpenShell
{
    /// <summary>
    /// Describes the implementation of the ConsoleWindowHelper class
    /// </summary>
    internal interface IConsoleWindowHelper
    {
        /// <summary>
        /// Pokes into the console buffer, and returns a 2D array of the buffer contents
        /// </summary>
        /// <returns></returns>
        BufferCell[,] GetBufferData(Rectangle rectangle);

        /// <summary>
        /// Gets the cursor position of the console
        /// </summary>
        /// <returns>Returns the X,Y position of the cursor</returns>
        Coordinates GetCursorPositon();

        /// <summary>
        /// Sets the consoles cursor position
        /// </summary>
        /// <param name="position">The new position to set the cursor too</param>
        void SetCursorPosition(Coordinates position);

        /// <summary>
        /// Gets the maximum physical window size of the console
        /// </summary>
        /// <returns>The maximum physical window size</returns>
        Size GetMaxPhysicalWindowSize();

        /// <summary>
        /// Flushes anything left in the input buffer
        /// </summary>
        void FlushInputStream();

        /// <summary>
        /// Moves a block of data in a screen buffer.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="destination"></param>
        /// <param name="clip"></param>
        /// <param name="fill"></param>
        void ScrollScreenBuffer(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill);

        /// <summary>
        /// Fills the region of the buffer with a specified character
        /// </summary>
        /// <param name="rectangle">the region of the buffer</param>
        /// <param name="fill">the character to fill in the buffer</param>
        void FillBufferContents(Rectangle rectangle, BufferCell fill);

        /// <summary>
        /// Sets the buffer contents started at the origin
        /// </summary>
        /// <param name="origin">buffer offset</param>
        /// <param name="contents">content to fill in the buffer</param>
        void SetBufferContents(Coordinates origin, BufferCell[,] contents);
    }
}
